//
//  ServiceManager.h
//
//
//  Created by Chen Yanjun on 12/5/12.
//  Copyright (c) 2012. All rights reserved.
//

#import "AFHTTPSessionManager.h"

typedef void (^ServiceRequestSuccessCallback) (NSDictionary *result, id response);
typedef void (^ServiceRequestFailureCallback) (NSString *errorMessage);

@interface ServiceManager : AFHTTPSessionManager
+ (ServiceManager *)sharedManager;

#pragma mark - Stub
- (id)stubWithFile:(NSString *)filename;

- (void)getTokenWithSuccess:(ServiceRequestSuccessCallback)success
                    failure:(ServiceRequestFailureCallback)failure;

- (void)refreshTokenWithSuccess:(ServiceRequestSuccessCallback)success
                        failure:(ServiceRequestFailureCallback)failure;

- (void)registerWithEmail:(NSString *)email
                 password:(NSString *)password
                 username:(NSString *)username
                  Success:(ServiceRequestSuccessCallback)success
                  failure:(ServiceRequestFailureCallback)failure;

- (void)loginWithPassword:(NSString *)password
                 username:(NSString *)username
                  Success:(ServiceRequestSuccessCallback)success
                  failure:(ServiceRequestFailureCallback)failure;

- (void)logoutWithSuccess:(ServiceRequestSuccessCallback)success
                  failure:(ServiceRequestFailureCallback)failure;
@end
